package com.best.oasis.settlement.util;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Logger {
	
	private static FileOutputStream fos;
	
	public static void openLog(){
		try {
			fos = new FileOutputStream("d:\\import_log"+new SimpleDateFormat("yyMMddkkmmss").format(new Date())+".txt", true);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
	
	public static void log(String message){
		try {
			fos.write((message+"\r\n").getBytes());
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public static void log(String message, int rowIndex){
		log("行"+ rowIndex+"：" + message);
	}
	
	public static void closeLog(){
		try {
			fos.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
